package com.itlong.cloud.resource;

import com.itlong.cloud.POJO.VO.app.AppTCPResultVO;
import com.itlong.cloud.common.network.ITCPServiceClient;
import com.itlong.cloud.service.ITCPService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * <desc>
 *      TCP业务处理暴露接口
 * </desc>
 *
 * @createDate 2018/09/12
 */
@RestController
public class TCPServiceResource implements ITCPServiceClient {
    @Autowired
    private ITCPService itcpService;

    /**
     * <desc>
     *      发送消息到TCP服务
     * </desc>
     *
     * @param userId 用户编号
     * @param sipAccount sip帐号
     * @param message 指令相关信息
     * @param cmdFlag 指令命令 10开门  11音视频切换
     * @return
     * @author Qiang.S
     * @createDate 2018/09/12
     */
    @Override
    @RequestMapping("/network/tcp/sendMessage")
    public AppTCPResultVO sendMessage(@RequestParam("userId") String userId, @RequestParam("sipAccount") String sipAccount,
                                      @RequestParam("message") String message, @RequestParam("cmdFlag") int cmdFlag) {
        return itcpService.sendMessage(userId,sipAccount,message,cmdFlag);
    }
}
